var redisManager = require('./redisManager');
var CONFIG = require('../../../../common/config');
var moment = require('moment');
var async = require('async');


var luaUtil = (function () {

    function luaUtil() {
    }



    /**
     * 保存活动信息或修改活动信息
     * @author mk
     * @date 2018-5-30
     * @param actId 活动id
     * @param callback 0/1 0表示成功，1表示失败
     */
    luaUtil.statisticsActivityInfo= function (actId,callback) {
        redisManager.getApiRedisDBMgr(function (getMgrErr, scriptMgr) {
            if(getMgrErr) {
                return callback(getMgrErr);
            }
            var keys = [];
            var values = [];
            values.push(actId);
            scriptMgr.run('saveActivityInfo', keys, values, function (error,result) {
                return callback(error,result);
            });
        });
    };


    /**
     * 记录用户验证身份证次数
     * @author mk
     * @date 2018-5-30
     * @param userId 用户id
     * @param callback 0/1 0表示成功，1表示失败
     */
    luaUtil.checkUserUseCount= function (userId,callback) {
        redisManager.getApiRedisDBMgr(function (getMgrErr, scriptMgr) {
            if(getMgrErr) {
                return callback(getMgrErr);
            }
            var keys = [];
            var values = [];
            values.push(userId);
            scriptMgr.run('checkUserUseCount', keys, values, function (error,result) {
                return callback(error,result);
            });
        });
    };




    return luaUtil;
})();

module.exports = luaUtil;